package com.SMP.service.class_room;
import java.util.Date;
import java.util.List;
import com.SMP.dao.RoomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.SMP.model.Room;
@Service
public class RoomService {
    /**
     * @author GJ
     */
    @Autowired
    RoomMapper roomMapper;
    /**
     * @author GJ
    //	 * @param 查询所有房间
     * */
    public List<Room> selAllRoom() {
        List<Room> list=roomMapper.selectRoomAll();
        return list;
    }
    /**
     * @author GJ
    //	 * @param 查询房间详细信息
     * */
    public Room selRoom(String id){

        return roomMapper.selectByPrimaryKey(id);
    }

    /**
     * @author GJ
    //	 * @param 添加房间
     * */
    public int addRoom(Room room){
        room.setInputTime(new Date());
        return roomMapper.insert(room);
    }
    /**
     * @author GJ
    //	 * @param 修改房间
     * */
    public int updRoom(Room room){

        return roomMapper.updateByPrimaryKey(room);
    }
    /**
     * @author GJ
    //	 * @param 删除房间
     * */
    public int delRoomF(String id){
        Room room=roomMapper.selectByPrimaryKey(id);
        room.setStandby1("2");
        return roomMapper.updateByPrimaryKey(room);
    }
    /**
     * @author GJ
    //	 * @param 按照房间编号查询房间
     * */
    public List<Room> selRoomById(String id) {
        List<Room> list=roomMapper.selectRoomById(id);
        return list;
    }
    /**
     * @author GJ
    //	 * @param 按照房间名查询房间
     * */
    public List<Room> selRoomByName(String name) {
        List<Room> list=roomMapper.selectRoomByName(name);
        return list;
    }
    /**
     * @author GJ
    //	 * @param 按照设备Id查询房间
     * */
    public List<Room> selRoomByEid(String equipmentId) {
        List<Room> list=roomMapper.selectRoomByEid(equipmentId);
        return list;
    }
    /**
     * @author GJ
    //	 * @param 按照设房间使用情况查询房间
     * */
    public List<Room> selRoomByUse(String roomUse) {
        List<Room> list=roomMapper.selectRoomByUse(roomUse);
        return list;
    }
    /**
     * @author GJ
    //	 * @param 按照设房间类型查询房间
     * */
    public List<Room> selRoomByType(String roomType) {
        List<Room> list=roomMapper.selectRoomByType(roomType);
        return list;
    }

}

